import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';

class TogglePage extends StatefulWidget {
  const TogglePage({Key? key}) : super(key: key);

  @override
  State<TogglePage> createState() => _TogglePageState();
}

class _TogglePageState extends State<TogglePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Toggle 开关"),
      ),
      body: Container(
        padding: const EdgeInsets.only(left: 16, right: 16, top: 20),
        child: childBody(),
      ),
    );
  }

  childBody() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        TextView.text("ios"),
        Container(
          padding: const EdgeInsets.symmetric(vertical: 16),
          child: Row(
            children: [
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.ios,
                enabledTrackColor: YJColors.PRIMARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.ios,
                enabledTrackColor: YJColors.SECONDARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.ios,
                enabledTrackColor: YJColors.SUCCESS,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.ios,
                enabledTrackColor: YJColors.THEME_COLOR,
              )
            ],
          ),
        ),
        const SizedBox(height: 16),
        TextView.text("android"),
        Container(
          padding: const EdgeInsets.symmetric(vertical: 16),
          child: Row(
            children: [
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.android,
                enabledTrackColor: YJColors.PRIMARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.android,
                enabledTrackColor: YJColors.SECONDARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.android,
                enabledTrackColor: YJColors.SUCCESS,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.android,
                enabledTrackColor: YJColors.THEME_COLOR,
              ),
            ],
          ),
        ),
        const SizedBox(height: 16),
        TextView.text("Square"),
        Container(
          padding: const EdgeInsets.symmetric(vertical: 16),
          child: Row(
            children: [
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.square,
                enabledTrackColor: YJColors.PRIMARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.square,
                enabledTrackColor: YJColors.SECONDARY,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.square,
                enabledTrackColor: YJColors.SUCCESS,
              ),
              const SizedBox(width: 10),
              YJToggle(
                onChanged: (val) {},
                value: true,
                type: YJToggleType.square,
                enabledTrackColor: YJColors.THEME_COLOR,
              ),
            ],
          ),
        ),
      ],
    );
  }
}
